import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created by mac on 2017/6/1.
 */
public class test {
    public static void main(String[] args) throws IOException {
        test.dump(new FileInputStream(args[0]));
    }

    public static void dump(InputStream src)
            throws IOException {
        try (InputStream input = src) {
            byte[] data2 = new byte[8];
            byte[] data = new byte[100];
            for (int j = 0; input.read(data2) != -1; j++) {
                data[j] = To10(data2);
                System.out.println(data[j]);
                int tempx = (int)data[j];
                System.out.println(tempx);
            }
        }
    }

    public static byte To10(byte[] input) {
    String s = new String(input);               //将二进制字符数组传唤为字符串
    System.out.println(s);
    byte temp = Byte.valueOf(s, 2);             //将字符串转换为十进制字符
    temp -= '0';
    System.out.println(temp);
    return temp;
}
}
